{template 'common/header'}

<!-- 模态框（Modal） -->
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">日志编辑</h4>
            </div>
            <div class="modal-body">
            	<form class="form-horizontal" role="form" action="{php echo $this->createWebUrl('list')}&action=save" method="post">
                  <div class="form-group">
                    <label for="firstname" class="col-sm-2 control-label">标题</label>
                    <div class="col-sm-10">
                      <input type="text" name='title' class="form-control" id="firstname" placeholder="请输入名字">
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="lastname" class="col-sm-2 control-label">图片</label>
                    <div class="col-sm-10">
                      {php echo tpl_form_field_image('image');}
                      <input name='id' type="hidden">
                    </div>
                  </div>
                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <button type="submit" class="btn btn-danger">提交</button>
                    </div>
                  </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->

{template 'common/footer'}
<script>
$(function(){
	$(".btn-edit").click(function(){
		var id=$(this).attr('id');
		//alert(id);
		$.get("{php echo $this->createWebUrl('list')}"+"&action=get&id="+id,function(result){
			var data=$.parseJSON(result);
			$("input[name='image']").val(data.image);
			$("input[name='id']").val(data.id);
			$("input[name='title']").val(data.title);
			$(".img-responsive").attr('src',data.true_image);
			})
		})
	
	})
</script>